import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
import VueRouter from 'vue-router';
import router from './router';
import '@babel/polyfill';
import './assets/style/global.less';
import store from './store/index';
import moment from 'moment';
import md5 from 'js-md5';
import Viewer from 'v-viewer';
import 'viewerjs/dist/viewer.css';
Vue.use(Viewer);
Viewer.setDefaults({
    Options: {
        'inline': true, 'button': true, 'navbar': true,
        'title': true, 'toolbar': true, 'tooltip': true,
        'movable': true, 'zoomable': true, 'rotatable': true,
        'scalable': true, 'transition': true, 'fullscreen': true, 'keyboard': true, 'url': 'data-source'},
});

Vue.prototype.$md5 = md5;


Vue.use(ElementUI);
Vue.prototype.$moment = moment;

Vue.prototype.$store = store;
Vue.prototype.statusMap = {
    1: '待支付',
    2: '已支付待审核',
    3: '完成',
    4: '审核未通过',
    5: '部分支付待审核',
    6: '部分支付完成',
};

// 获取原型对象上的push函数 修改原型对象中的push方法
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

Vue.use(VueRouter);

Vue.config.productionTip = false;

new Vue({
    el: '#app',
    router,
    render: h => h(App),
});
